﻿<telerik:RadWindow x:Class="ProTemplate.UserControls.RadWindows.BatchAddDeclarationForm"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:my="clr-namespace:ProTemplate.UserControls"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input"
    xmlns:myRowSelectors="clr-namespace:ProTemplate.Utility.Selectors"
    xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    mc:Ignorable="d" Header="批量新增报关单" Style="{StaticResource CommonRadWindowStyle}" WindowState="Maximized"
    d:DesignHeight="300" d:DesignWidth="400" telerik:Theming.Theme="Office_Blue" WindowStartupLocation="CenterScreen" Loaded="RadWindow_Loaded">
    
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.Resources>
            <Style x:Key="GreenRowStyle" TargetType="telerik:GridViewRow">
                <Setter Property="Foreground" Value="Green" />
            </Style>
            <Style x:Key="DefaultRowStyle" TargetType="telerik:GridViewRow"/>

            <myRowSelectors:ConditionalStyleSelector x:Key="selector" ConditionConverter="{StaticResource CorporationConverter}">
                <myRowSelectors:ConditionalStyleSelector.Rules>
                    <myRowSelectors:ConditionalStyleRule Style="{StaticResource DefaultRowStyle}">
                        <myRowSelectors:ConditionalStyleRule.Value>
                            <sys:Int32>0</sys:Int32>
                        </myRowSelectors:ConditionalStyleRule.Value>
                    </myRowSelectors:ConditionalStyleRule>
                    <myRowSelectors:ConditionalStyleRule Style="{StaticResource GreenRowStyle}">
                        <myRowSelectors:ConditionalStyleRule.Value>
                            <sys:Int32>1</sys:Int32>
                        </myRowSelectors:ConditionalStyleRule.Value>
                    </myRowSelectors:ConditionalStyleRule>
                </myRowSelectors:ConditionalStyleSelector.Rules>
            </myRowSelectors:ConditionalStyleSelector>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <my:EditWindowToolBar x:Name="toolBar" Grid.Row="0" SaveAndClose="EditWindowToolBar_SaveAndClose"  Close="EditWindowToolBar_Close" SaveAndNew="toolBar_SaveAndNew" />
        <telerikGridView:RadGridView telerik:Theming.Theme="Office_Blue" x:Name="gdDeclaration" Grid.Row="1" Style="{StaticResource CommonEditableRadGridView}" 
                                     SelectionMode="Single" ShowGroupPanel="False" RowStyleSelector="{StaticResource selector}"
                                     >
            <telerikGridView:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="序号" DataMemberBinding="{Binding Index}" IsFilterable="False" IsReadOnly="True"/>
                <telerik:GridViewDataColumn Header="客户" DataMemberBinding="{Binding CustomerName,Mode=TwoWay}" IsFilterable="False" Width="100">
                    <telerik:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>
                            <input:AutoCompleteBox x:Name="acbCustomer" Text="{Binding CustomerName, Mode=TwoWay}" FilterMode="None" Populating="acbCustomer_Populating" ValueMemberPath="Name" DropDownClosed="acbCustomer_DropDownClosed" >
                                <input:AutoCompleteBox.ItemTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Name}" />
                                    </DataTemplate>
                                </input:AutoCompleteBox.ItemTemplate>
                            </input:AutoCompleteBox>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="接收日期" DataMemberBinding="{Binding ReceivedDate,Mode=TwoWay, Converter={StaticResource ChineseDateConverter}}" IsFilterable="False" Width="170">
                    <telerik:GridViewDataColumn.CellEditTemplate>
                        <DataTemplate>
                            <sdk:DatePicker x:Name="dpReceiveDate"  VerticalAlignment="Center" Width="170" SelectedDate="{Binding ReceivedDate,Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True,UpdateSourceTrigger=Explicit}"  />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellEditTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="海关编号" DataMemberBinding="{Binding DeclarationNumber, Mode=TwoWay}" IsFilterable="False" Width="160" />
                <telerik:GridViewDataColumn Header="经营单位代码" DataMemberBinding="{Binding TraderCode, Mode=TwoWay}" IsFilterable="False" Width="120" />
                <telerik:GridViewDataColumn Header="提运单号" DataMemberBinding="{Binding BillNumber, Mode=TwoWay}" IsFilterable="False" Width="120" />
                <telerik:GridViewDataColumn Header="批准文号" DataMemberBinding="{Binding ApprovalNumber,  Mode=TwoWay}" IsFilterable="False" Width="120" />
                <telerik:GridViewDataColumn Header="运编号" DataMemberBinding="{Binding RelatedSystemNumber, Mode=TwoWay}" IsFilterable="False" Width="120" />
                <telerik:GridViewDataColumn Header="注释" DataMemberBinding="{Binding Remark,  Mode=TwoWay}" Width="120" />
                <!--<telerik:GridViewDataColumn Header="报关费" DataMemberBinding="{Binding DeclarationFeeAmount,  Mode=TwoWay}" Width="100" />
                <telerik:GridViewDataColumn Header="商检费" DataMemberBinding="{Binding ExaminationFeeAmount,  Mode=TwoWay}" Width="100" />
                <telerik:GridViewDataColumn Header="商检费成本" DataMemberBinding="{Binding ExaminationFeeCost,  Mode=TwoWay}" Width="100" />
                <telerik:GridViewDataColumn Header="查验费" DataMemberBinding="{Binding CheckFeeAmount,  Mode=TwoWay}" Width="100" />
                <telerik:GridViewDataColumn Header="查验费成本" DataMemberBinding="{Binding CheckFeeCost,  Mode=TwoWay}" Width="100" />
                <telerik:GridViewDataColumn Header="代办费" DataMemberBinding="{Binding CommissionFeeAmount,  Mode=TwoWay}" Width="100" />
                <telerik:GridViewDataColumn Header="代办费成本" DataMemberBinding="{Binding CommissionFeeCost,  Mode=TwoWay}" Width="100" />
                <telerik:GridViewDataColumn Header="财务情况" DataMemberBinding="{Binding FinancialRemark,  Mode=TwoWay}" Width="100" />-->
            </telerikGridView:RadGridView.Columns>
        </telerikGridView:RadGridView>

        <Border Grid.RowSpan="2">
            <telerik:RadBusyIndicator x:Name="busyIndicator" DisplayAfter="0" IsBusy="False" BusyContent="正在处理，请稍候..." />
        </Border>
    </Grid>
</telerik:RadWindow>
